package com.paomi.client.activity.person;

import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
import com.hannesdorfmann.mosby3.mvp.MvpPresenter;
import com.paomi.client.R;
import com.paomi.client.base.BaseMvpActivity;

import butterknife.BindView;

public class AboutUsActivity extends BaseMvpActivity {
    @BindView(R.id.tv_app_id)
    TextView tv_app_id;
    @BindView(R.id.button_goback)
    TextView button_goback;

    @NonNull
    @Override
    public MvpPresenter createPresenter() {
        return new MvpBasePresenter();
    }

    @Override
    protected String setTitle() {
        return getResources().getString(R.string.about_us);
    }

    @Override
    protected void showBack(TextView button_goback) {
        button_goback.setVisibility(View.VISIBLE);
    }

    @NonNull
    @Override
    protected int getLayoutId() {
        return R.layout.activity_about_us;
    }

    @Override
    protected void initEvent() {
        button_goback.setTypeface(iconfont);
        button_goback.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
        button_goback.setTextColor(getResources().getColor(R.color.main_color));
        button_goback.setText(getResources().getString(R.string.back_normal) + getResources().getString(R.string.back));
        getAppInfo();
    }

    private void getAppInfo() {
        try {
            String pkName = this.getPackageName();
            String versionName = this.getPackageManager().getPackageInfo(
                    pkName, 0).versionName;
            int versionCode = this.getPackageManager()
                    .getPackageInfo(pkName, 0).versionCode;
            tv_app_id.setText(getResources().getString(R.string.app_id) + " " + versionName);
        } catch (Exception e) {
        }
    }
}
